package com.faiz.algorithm;

public class InclinedVisit {

    // 遍历左上角
    public static void visitTopLeft(int n) {
        for (int l = 1; l <= n; l++) {
            for (int i = 0; i < l; i++) {
                int j = l - i - 1;
                System.out.print("(" + i + "," + j + ")");
            }
            System.out.println();
        }
    }

    // 遍历右下角
    public static void visitBottomRight(int n) {
        for (int l = 1; l <= n; l++) {
            for (int i = n - 1 ; i >= l - 1 ; i--) {
                int j = n - i + l - 2;
                System.out.print("(" + i + "," + j + ")");
            }
            System.out.println();
        }
    }

    public static void main(String[] args) {
        visitBottomRight(5
        );
    }
}
